//
//  MessageViewController.m
//  weibo-01
//
//  Created by HZApple on 16/5/9.
//  Copyright © 2016年 hdu. All rights reserved.
//

#import "MessageViewController.h"

#import "FacePannel.h"
#import "MMDrawerController.h"


@interface MessageViewController ()<UIScrollViewDelegate>{
    UIPageControl *pageControl;
}

@end

@implementation MessageViewController

- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    
    MMDrawerController *drawCtrl = (MMDrawerController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    
    [drawCtrl setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
    
}

- (void)viewWillDisappear:(BOOL)animated {
    
    [super viewWillDisappear:animated];
    
    MMDrawerController *drawCtrl = (MMDrawerController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    
    [drawCtrl setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"消息";
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = NO;//是，图层从导航栏正下方开始计算
    FacePannel *facePannel = [[FacePannel alloc] initWithFrame:CGRectMake(0, 200, 0, 0)];
    [self.view addSubview:facePannel];
    
    
    
//    self.automaticallyAdjustsScrollViewInsets = NO; //滑动视图是否向下自动偏移
//    
//    FaceView *faceView = [[FaceView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
//    
//    faceView.clipsToBounds = YES;
//    //NSLog(@"faceViewSize:%@",NSStringFromCGSize(faceView.frame.size));
//    
//    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, kScreenWidth, faceView.height)];
//    
//    scrollView.pagingEnabled = YES;
//    
//    scrollView.clipsToBounds = YES;
//    
//    scrollView.contentSize = CGSizeMake(faceView.width, faceView.height);
//    
//    scrollView.delegate = self;
//    
//    [scrollView addSubview:faceView];
//    
//    [self.view addSubview:scrollView];
//    
//    
//    pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 20)];
//    pageControl.numberOfPages = faceView.width / kScreenWidth;
//    
//    pageControl.top = scrollView.bottom;
//    
//    [self.view addSubview:pageControl];
    
    
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    NSInteger i = scrollView.contentOffset.x / kScreenWidth;
    pageControl.currentPage = i;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
